package com.suntop.carousel.qlmediaplay.video.player;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;

import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.request.RequestOptions;
import com.suntop.carousel.qlmediaplay.media.IMediaPlayer;
import com.suntop.carousel.qlmediaplay.video.ui.IRenderView;
import com.suntop.carousel.qlmediaplay.video.ui.TextureRenderView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@SuppressLint("NewApi")
public class QLVideoView extends QLBasicVideoView{

    private int type=0;

    public QLVideoView(@NonNull Context context) {
        super(context);
    }


    public QLVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public QLVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public QLVideoView setMediaType(int type) {
        this.type=type;
        return this;
    }

    @Override
    protected IRenderView getIRenderView() {
        return new TextureRenderView(getContext());
    }

    @Override
    protected IVideoPlayer getVideoPlayer() {
        if (type==1){
            return new QNMediaPlayer(getContext());
        }
        return new AndroidMediaPlayer(getContext());
    }


    @Override
    public IMediaPlayer initFarm(DecodeFormat decodeFormat) {
        return this;
    }


}
